Component({
    relations: {
        '../ui-search-picker/ui-search-picker': {
            type: 'parent'
        }
    },
    data: {
        pickerValue: ''
    },

    properties: {
        dataArray: {
            type: Array,
            value: []
        }
    },

    methods: {
        input(e) {
            const value = e.detail.value;
            this.setData({
                pickerValue: value
            });
            this.triggerEvent('inputEvent', value);
        },

        change(e) {
            const index = e.detail.value;
            const data = this.properties.dataArray[index];
            this.setData({
                pickerValue: data.title
            });
            this.triggerEvent('changeEvent', data.id);
        }
    }
})